#!/usr/bin/env python3
# coding=utf-8
import sys
import requests
import pprint
from bs4 import BeautifulSoup

queryWord = sys.argv[1]
reqWord = queryWord.replace(' ','%20')
print(queryWord)
req = requests.get('http://dict.youdao.com/w/eng/' + queryWord)
html = req.text
soup = BeautifulSoup(html, 'html.parser')
div = soup.find(name='div', attrs={'class':'trans-container'})

if div:
    wordBuff=div.get_text();
    wordBuff=wordBuff.replace(' ','')
    wordBuff=wordBuff.replace('\t','')
    printBuff=wordBuff.replace('\n',' ')
    pprint.pprint(printBuff,width=40)
